package com.youku
{
   import flash.events.EventDispatcher;
   import com.youku.interfaces.ICore;
   import flash.display.MovieClip;
   import com.youku.conductor.Conductor;
   import com.youku.core.CoreFacade;
   import flash.utils.Dictionary;
   import com.youku.utils.DependenceChecker;
   import com.youku.events.*;
   import com.youku.error.*;
   import com.youku.core.model.vo.PlayListData;
   import com.youku.interfaces.IRootData;
   import com.youku.skin.PartenerSkinManager;
   import com.youku.utils.FlashVersionCheck;
   import com.youku.utils.StringUtil;
   import com.youku.controls.TipsController;
   import com.youku.controls.InteractionController;
   import com.youku.controls.ControlbarV4Controller;
   import com.youku.controls.TopbarV4Controller;
   import com.youku.controls.EndCardV4NewController;
   import com.youku.controls.SearchbarV4Controller;
   import com.youku.controls.ShareV4Controller;
   import com.youku.controls.ProgramListV4Controller;
   import com.youku.controls.ToolBoxV4Controller;
   import com.youku.controls.CommonUIController;
   import com.youku.controls.JumpController;
   import com.youku.controls.ReportController;
   import com.youku.controls.ExPluginController;
   import com.youku.controls.ContextMenuController;
   import com.youku.controls.VideoPanelController;
   import com.youku.controls.ADController;
   import com.youku.controls.FeedbackController;
   import com.youku.controls.LogoController;
   import com.youku.controls.AccController;
   import com.youku.controls.LiveLoaderController;
   import com.youku.data.PlayerConstant;
   import com.youku.conductor.ConductorState;
   import com.youku.data.PlayerContext;
   import com.youku.interfaces.IProgramData;
   import com.youku.utils.OpenWindow;
   import flash.net.URLRequest;
   import com.youku.interfaces.IPlayListData;
   import flash.utils.setTimeout;
   
   public class FacadeManager extends EventDispatcher
   {
      
      public function FacadeManager() {
         this._errorMsg = {};
         super();
      }
      
      private var _core:ICore;
      
      private var _mainMc:MovieClip;
      
      private var _conductor:Conductor;
      
      private var _coreFacade:CoreFacade;
      
      private var _dispatcherEvents:Dictionary;
      
      private var _playerProxy:PlayerProxy;
      
      private var _fsoProxy:FSOProxy;
      
      private var _externalInterfaceProxy:ExternalProxy;
      
      private var _userActionDispatcher:UserActionDispatcher;
      
      private var _currentADType:String;
      
      private var _holdonPlayVidEncoded:String;
      
      private var _skipFrontAD:Boolean = false;
      
      private var _startToLoadVideo:Boolean = false;
      
      private var _jumpHeadTail:Boolean = false;
      
      private var _restorLastPosition:Boolean = false;
      
      private var _restorServerPosition:Boolean = false;
      
      private var _currentPanelType:String = "";
      
      private var _coreInited:Boolean = false;
      
      private var _initDependenceChecker:DependenceChecker;
      
      private var _errorMsg:Object;
      
      protected function get viewManager() : ViewManager {
         return GlobalService.getService(GlobalServiceKeys.VIEW_MANAGER) as ViewManager;
      }
      
      public function init() : void {
         this._dispatcherEvents = new Dictionary();
         this._conductor = new Conductor();
         GlobalService.addService(GlobalServiceKeys.CONDUCTOR,this._conductor);
         var _loc1_:Array = [];
         _loc1_.push(ConductorEvent.METADATA_UPDATED);
         _loc1_.push(ConductorEvent.STATE_CHANGED);
         this._dispatcherEvents[this._conductor.toString()] = 
            {
               "dispatcher":this._conductor,
               "events":_loc1_
            };
         this.viewManager.addEventListener(ViewManagerEvent.FULLSCREEN_MODE_CHANGED,this.onViewManagerEvent);
         this.viewManager.addEventListener(ViewManagerEvent.PLAYER_SIZE_CHANGED,this.onViewManagerEvent);
         this._playerProxy = GlobalService.getService(GlobalServiceKeys.PLAYER_PROXY) as PlayerProxy;
         this._userActionDispatcher = GlobalService.getService(GlobalServiceKeys.USER_ACTION_DISPATCHER) as UserActionDispatcher;
         this._externalInterfaceProxy = new ExternalProxy();
         this._externalInterfaceProxy.addCallBacks();
         GlobalService.addService(GlobalServiceKeys.EXTERNALINTERFACE_PROXY,this._externalInterfaceProxy);
         this.attchExternalInterfaceEvents();
         this._fsoProxy = new FSOProxy();
         this._fsoProxy.init();
         GlobalService.addService(GlobalServiceKeys.FSO_PROXY,this._fsoProxy);
         this.setGUID();
         this.initPlugins();
         PlayerConfig.playListData = new PlayListData();
         this.viewManager.getInitialSize();
         this.viewManager.dispatchEvent(new ViewManagerEvent(ViewManagerEvent.PLAYER_SIZE_CHANGED));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_LOADING));
         this._coreFacade = CoreFacade.getInstance();
         GlobalService.addService(GlobalServiceKeys.CORE_FACADE,this._coreFacade);
         this._playerProxy.addEventListener(CoreEvent.PLAYLIST_DADA_LOADED,this.onCorePlayListDataLoaded);
         this._playerProxy.addEventListener(CoreEvent.CORE_INITED,this.onCoreInited);
         _loc1_ = [];
         var _loc2_:IRootData = PlayerConfig.rootData;
         _loc2_.continuous = this._fsoProxy.getContinuous();
         _loc2_.jump = this._fsoProxy.getJump();
         _loc2_.isMute = false;
         PlayerConfig.rootData = _loc2_;
         this._playerProxy.dispatchEvent(new ConductorEvent(ConductorEvent.ROOTDATA_UPDATED));
         if(this.isOuterPlayer)
         {
            this._playerProxy.dispatchEvent(new ReportEvent(ReportEvent.EXTERIOR_REPORT,
               {
                  "t":1,
                  "a":1
               }));
         }
         this._errorMsg = {};
         this._conductor.init(this.viewManager.videoLayer);
         if((PlayerConfig.partnerData) && _loc2_.styleid > 0)
         {
            PartenerSkinManager.upDateAllSkin();
         }
      }
      
      private function checkFlashVersion() : Boolean {
         var _loc1_:Boolean = FlashVersionCheck.checkVersionForNewVersion();
         if(_loc1_)
         {
            return true;
         }
         return true;
      }
      
      private function flashVersionCheckError() : void {
         var _loc1_:Object = {};
         _loc1_.level = ErrorLevel.FATAL_ERROR;
         _loc1_.code = ErrorCode.FLASH_VERSION_LOW;
         _loc1_.type = ErrorType.NORMAL_ERROR;
         _loc1_.message = ErrorConstant.FLASH_VERSION_LOW;
         var _loc2_:PluginEvent = new PluginEvent(PluginEvent.PLUGIN_ERROR,_loc1_);
         this._playerProxy.dispatchEvent(_loc2_);
      }
      
      private function setGUID() : void {
         var _loc1_:* = "";
         if(this._fsoProxy.getGUID() == null)
         {
            _loc1_ = StringUtil.getGUID();
            this._fsoProxy.setGUID(_loc1_);
         }
         else
         {
            _loc1_ = this._fsoProxy.getGUID();
         }
         PlayerConfig.GUID = _loc1_;
      }
      
      private function onCorePlayListDataLoaded(param1:CoreEvent) : void {
         PlayerConfig.playListData = param1.data.playListData;
         GlobalService.removeService(GlobalServiceKeys.PLAYLIST_DATA);
         GlobalService.addService(GlobalServiceKeys.PLAYLIST_DATA,param1.data.playListData);
         PlayerConfig.startPosition = this.judgeStartPosition();
         this._playerProxy.dispatchEvent(new ConductorEvent(ConductorEvent.METADATA_UPDATED));
      }
      
      private function onCoreInited(param1:CoreEvent) : void {
         this._dispatcherEvents = new Dictionary();
         this._core = param1.data.core;
         this.addCoreEvents();
         this._playerProxy.removeEventListeners(this._dispatcherEvents);
         this._playerProxy.addEventListeners(this._dispatcherEvents);
         this.checkDependences();
      }
      
      private function checkDependences() : void {
         if(this._initDependenceChecker == null || (this._initDependenceChecker.check()))
         {
            this.playerInitialized();
         }
      }
      
      private function playerInitialized() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_LOADING));
         this._conductor.playerInitialized();
      }
      
      private function initPlugins() : void {
         var _loc1_:TipsController = null;
         var _loc2_:InteractionController = null;
         var _loc3_:ControlbarV4Controller = null;
         var _loc4_:TopbarV4Controller = null;
         var _loc5_:EndCardV4NewController = null;
         var _loc6_:SearchbarV4Controller = null;
         var _loc7_:ShareV4Controller = null;
         var _loc8_:ProgramListV4Controller = null;
         var _loc9_:ToolBoxV4Controller = null;
         var _loc10_:CommonUIController = null;
         var _loc11_:JumpController = null;
         var _loc12_:ReportController = null;
         var _loc13_:ExPluginController = null;
         var _loc14_:ContextMenuController = null;
         var _loc15_:VideoPanelController = null;
         var _loc16_:ADController = null;
         var _loc17_:FeedbackController = null;
         var _loc18_:LogoController = null;
         var _loc19_:AccController = null;
         var _loc20_:LiveLoaderController = null;
         _loc1_ = new TipsController();
         _loc2_ = new InteractionController();
         _loc3_ = new ControlbarV4Controller();
         _loc4_ = new TopbarV4Controller();
         _loc5_ = new EndCardV4NewController();
         _loc6_ = new SearchbarV4Controller();
         _loc7_ = new ShareV4Controller();
         _loc8_ = new ProgramListV4Controller();
         _loc9_ = new ToolBoxV4Controller();
         _loc10_ = new CommonUIController();
         _loc11_ = new JumpController();
         _loc12_ = new ReportController();
         _loc13_ = new ExPluginController();
         _loc14_ = new ContextMenuController();
         _loc15_ = new VideoPanelController();
         _loc16_ = new ADController();
         _loc17_ = new FeedbackController();
         _loc18_ = new LogoController();
         _loc19_ = new AccController();
         _loc20_ = new LiveLoaderController();
         this._playerProxy.addEventListeners(this._dispatcherEvents);
         this.attchEvents();
      }
      
      private function attchEvents() : void {
         this._playerProxy.addEventListener(PluginEvent.PLUGIN_ERROR,this.onErrorEvent);
         this._playerProxy.addEventListener(PluginEvent.ALERT_BOX_SHOW,this.onAleatboxEvent);
         this._playerProxy.addEventListener(PluginEvent.ALERT_BOX_HIDE,this.onAleatboxEvent);
         this._playerProxy.addEventListener(PluginEvent.PANEL_STATE_CHANGE,this.onPanelStateChange);
      }
      
      private function attchExternalInterfaceEvents() : void {
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SEEK,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_PAUSE,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_RESUME,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_STOP,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_PLAY_NEW_VIDEO,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_CONTINUOUS,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_SHOW_MODE,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_SKIN_COLOR,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_THX,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_LIGHT,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SHOW_CONTROLBAR,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_RECORD_POSITION,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_VOLUME,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_LOOP,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_QUALITY,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_LANGUAGE,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_JUMP,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_ADJUST_PARAMETERS,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_SET_FAVORITE,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_DO_INTERACT,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_ADD_INTERACT,this.onExternalInterfaceEvent);
         this._externalInterfaceProxy.addEventListener(ExternalInterfaceEvent.EI_ZOOM_OUT,this.onExternalInterfaceEvent);
      }
      
      private function onCoreEvent(param1:CoreEvent) : void {
         switch(param1.type)
         {
            case CoreEvent.BUFFER_APPEARED:
               this._externalInterfaceProxy.playerStateChange("buffer");
               break;
            case CoreEvent.PLAY_START:
               break;
            case CoreEvent.PLAY_OVER:
               this._playerProxy.removeEventListener(CoreEvent.BUFFER_APPEARED,this.onCoreEvent);
               this._playerProxy.removeEventListener(CoreEvent.PLAY_START,this.onCoreEvent);
               this._playerProxy.removeEventListener(CoreEvent.PLAY_OVER,this.onCoreEvent);
               this._playerProxy.removeEventListener(CoreEvent.YK_GET_P2P_REMOVE_URL,this.onCoreEvent);
               this.requestAndPlayAd("postroll");
               break;
            case CoreEvent.YK_GET_P2P_REMOVE_URL:
               this._externalInterfaceProxy.htmlCloseCall(param1.data.url);
               break;
         }
      }
      
      private function onErrorEvent(param1:PluginEvent) : void {
         if(param1.type != PluginEvent.PLUGIN_ERROR)
         {
            return;
         }
         this._errorMsg = {};
         this._errorMsg.level = param1.data.level;
         this._errorMsg.message = param1.data.message;
         this._errorMsg.type = param1.data.type;
         this._errorMsg.code = param1.data.code;
         if(param1.data.oricode)
         {
            this._errorMsg.oricode = param1.data.oricode;
         }
         if(this._errorMsg.type == ErrorType.PAY_TRIAL_END_NOT_LOGIN || this._errorMsg.type == ErrorType.PAY_TRIAL_END_LOGINED)
         {
            this.jsCallOnTrialEnd();
            this.jsCallPlayerComplete();
         }
         this._playerProxy.addEventListener(PluginEvent.ERRORCARD_PLAY_WITH_PASSWORD,this.onErrorCardEvent);
         this._playerProxy.addEventListener(PluginEvent.ERRORCARD_REFRESH,this.onErrorCardEvent);
         if(this._errorMsg.level == ErrorLevel.FATAL_ERROR)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_ERROR_CARD,
               {
                  "type":this._errorMsg.type,
                  "message":this._errorMsg.message,
                  "code":this._errorMsg.code
               }));
            this._playerProxy.dispatchEvent(new ReportEvent(ReportEvent.PLAY_ERROR,
               {
                  "type":this._errorMsg.type,
                  "message":this._errorMsg.message,
                  "code":this._errorMsg.code
               }));
            this._conductor.meetFatalError();
         }
         else if(this._errorMsg.level == ErrorLevel.WARNING || this._errorMsg.level == ErrorLevel.NOTICE)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_ERROR_CARD,
               {
                  "type":this._errorMsg.type,
                  "message":this._errorMsg.message,
                  "code":this._errorMsg.code
               }));
         }
         
      }
      
      private function onAleatboxEvent(param1:PluginEvent) : void {
         switch(param1.type)
         {
            case PluginEvent.ALERT_BOX_SHOW:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.BEFORE_SHOW_PANELS,{"panel":PlayerConstant.PANEL_ALERT}));
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_ALERT_BOX,param1.data));
               break;
            case PluginEvent.ALERT_BOX_HIDE:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.AFTER_CLOSE_PANELS,{"panel":PlayerConstant.PANEL_ALERT}));
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_ALERT_BOX,param1.data));
               break;
         }
      }
      
      private function onPanelStateChange(param1:PluginEvent) : void {
         var _loc2_:Boolean = param1.data.state;
         if(_loc2_)
         {
            this._currentPanelType = param1.data.type;
         }
         else if(param1.data.type == this._currentPanelType)
         {
            this._currentPanelType = "";
         }
         
         var _loc3_:Boolean = this._currentPanelType == ""?false:true;
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.PANEL_STATE_CHANGE,{"havePanel":_loc3_}));
      }
      
      private function onViewManagerEvent(param1:ViewManagerEvent) : void {
         var _loc2_:Object = {};
         var _loc3_:Boolean = param1.data;
         var _loc4_:Number = 0;
         var _loc5_:Number = 0;
         var _loc6_:Number = 0;
         if(_loc3_)
         {
            _loc4_ = this.viewManager.stage.stageWidth;
            _loc5_ = this.viewManager.stage.stageHeight;
         }
         else
         {
            _loc4_ = PlayerConfig.normalWidth;
            _loc5_ = PlayerConfig.normalHeight;
         }
         _loc6_ = PlayerConfig.controlBarHeight;
         _loc2_.fullscreen = param1.data;
         _loc2_.width = _loc4_;
         _loc2_.height = _loc5_;
         _loc2_.cheight = _loc6_;
         switch(param1.type)
         {
            case ViewManagerEvent.FULLSCREEN_MODE_CHANGED:
               this._playerProxy.dispatchEvent(new ReportEvent(ReportEvent.FULLSCREEN_REPORT));
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.FULLSCREEN_CHANGED,_loc2_));
               break;
            case ViewManagerEvent.PLAYER_SIZE_CHANGED:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.PLAYER_SIZE_CHANGED,_loc2_));
               break;
         }
      }
      
      private function onExternalInterfaceEvent(param1:ExternalInterfaceEvent) : void {
         var _loc2_:* = NaN;
         var _loc3_:String = null;
         var _loc4_:* = false;
         var _loc5_:String = null;
         var _loc6_:* = false;
         var _loc7_:* = NaN;
         var _loc8_:* = false;
         var _loc9_:String = null;
         var _loc10_:String = null;
         var _loc11_:* = false;
         var _loc12_:* = false;
         switch(param1.type)
         {
            case ExternalInterfaceEvent.EI_SEEK:
               _loc2_ = param1.data.time;
               if(this._conductor.currentState == ConductorState.VIDEO)
               {
                  this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_SEEK,{"time":_loc2_}));
               }
               else if(this._conductor.currentState == ConductorState.VIDEO_END)
               {
                  this._conductor.replay(_loc2_);
               }
               
               break;
            case ExternalInterfaceEvent.EI_PAUSE:
               if(this._conductor.currentState == ConductorState.VIDEO)
               {
                  _loc12_ = param1.data.useraction;
                  this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PAUSE,{"useraction":_loc12_}));
               }
               break;
            case ExternalInterfaceEvent.EI_RESUME:
               this.onResume();
               break;
            case ExternalInterfaceEvent.EI_STOP:
               this.stopVideo();
               break;
            case ExternalInterfaceEvent.EI_PLAY_NEW_VIDEO:
               _loc3_ = param1.data.videoid;
               if(!(param1.data.quality == null) && !(param1.data.quality == ""))
               {
                  PlayerConfig.rootData.firstQuality = param1.data.quality;
               }
               this.playNewVideo(_loc3_);
               break;
            case ExternalInterfaceEvent.EI_SET_CONTINUOUS:
               _loc4_ = param1.data.continuous;
               PlayerConfig.rootData.continuous = _loc4_;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_SET_CONTINUOUS,{"continuous":_loc4_}));
               break;
            case ExternalInterfaceEvent.EI_SET_SHOW_MODE:
               _loc5_ = param1.data.mode;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_CHANGE_SCREEN_MODE,
                  {
                     "mode":_loc5_,
                     "tween":true
                  }));
               break;
            case ExternalInterfaceEvent.EI_SET_SKIN_COLOR:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CONTROLBAR_CHANGE_COLOR,param1.data));
               break;
            case ExternalInterfaceEvent.EI_SET_THX:
               if(param1.data)
               {
                  PlayerConfig.rootData.THX = param1.data.state;
               }
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SIDEBAR_SET_THX));
               break;
            case ExternalInterfaceEvent.EI_SET_LIGHT:
               if(param1.data)
               {
                  PlayerConfig.rootData.light = param1.data.state;
               }
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SIDEBAR_SET_LIGHT));
               break;
            case ExternalInterfaceEvent.EI_SHOW_CONTROLBAR:
               _loc6_ = param1.data.show as Boolean;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CONTROLBAR_SHOWHIDE,{"show":_loc6_}));
               break;
            case ExternalInterfaceEvent.EI_RECORD_POSITION:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_RECORD_POSITION));
               break;
            case ExternalInterfaceEvent.EI_SET_VOLUME:
               _loc7_ = param1.data.volume;
               PlayerContext.volume = _loc7_;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_CHANGE_VOLUME,{"volume":_loc7_}));
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CONTROLBAR_SET_VOLUME,{"volume":_loc7_}));
               break;
            case ExternalInterfaceEvent.EI_SET_LOOP:
               _loc8_ = param1.data.isLoop;
               PlayerConfig.rootData.isLoop = _loc8_;
               break;
            case ExternalInterfaceEvent.EI_SET_QUALITY:
               _loc9_ = param1.data.quality;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_CHANGE_QUALITY,{"quality":_loc9_}));
               break;
            case ExternalInterfaceEvent.EI_SET_LANGUAGE:
               _loc10_ = param1.data.lang;
               this.changeVoice(_loc10_);
               break;
            case ExternalInterfaceEvent.EI_SET_JUMP:
               _loc11_ = param1.data.jump;
               PlayerConfig.rootData.jump = _loc11_;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_SET_JUMP,{"jump":_loc11_}));
               break;
            case ExternalInterfaceEvent.EI_SET_ADJUST_PARAMETERS:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_CHANGE_ADJUST_PARAMETERS,param1.data));
               break;
            case ExternalInterfaceEvent.EI_SET_FAVORITE:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.END_CARD_SET_FAVORITE,param1.data));
               break;
            case ExternalInterfaceEvent.EI_DO_INTERACT:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.DO_INTERACT,param1.data));
               break;
            case ExternalInterfaceEvent.EI_ADD_INTERACT:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.ADD_INTERACT,param1.data));
               break;
            case ExternalInterfaceEvent.EI_ZOOM_OUT:
               this.viewManager.zoomOut();
               break;
         }
      }
      
      public function processADEvent(param1:PluginEvent) : void {
         var _loc2_:* = false;
         var _loc3_:* = NaN;
         switch(param1.type)
         {
            case PluginEvent.AD_REQUEST_TO_PLAY:
               this._currentADType = "middle";
               this._conductor.gotoPlayAd();
               break;
            case PluginEvent.AD_READY_OR_ERROR:
               if(this._currentADType == "preroll")
               {
                  this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_LOADING));
               }
               break;
            case PluginEvent.AD_LOAD_COMPLETE:
               if(this._currentADType == "preroll" && !this._startToLoadVideo)
               {
                  this._startToLoadVideo = true;
                  this.realStartToLoadVideo();
               }
               break;
            case PluginEvent.AD_PLAY_COMPLETE:
               this._conductor.adEnd();
               break;
            case PluginEvent.AD_ADPOINT_LOADED:
               break;
            case PluginEvent.AD_REQUEST_TO_RESUME:
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_RESUME));
               break;
            case PluginEvent.AD_SOUND_MUTE:
               _loc2_ = param1.data.mute;
               _loc3_ = param1.data.volume;
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CONTROLBAR_SET_VOLUME,{"volume":_loc3_}));
               break;
            case PluginEvent.AD_GET_FOCUS:
               this._userActionDispatcher.keyboardEnable = false;
               break;
            case PluginEvent.AD_LOST_FOCUS:
               this._userActionDispatcher.keyboardEnable = true;
               break;
         }
      }
      
      public function gotoPlayAd() : void {
         this._conductor.gotoPlayAd();
      }
      
      private function onErrorCardEvent(param1:PluginEvent) : void {
         var _loc2_:String = null;
         var _loc3_:String = null;
         switch(param1.type)
         {
            case PluginEvent.ERRORCARD_PLAY_WITH_PASSWORD:
               _loc2_ = param1.data as String;
               PlayerConfig.rootData.passwords = _loc2_;
               this._conductor.playNewVideo(PlayerConfig.playListData.vidEncoded);
               break;
            case PluginEvent.ERRORCARD_REFRESH:
               this._skipFrontAD = true;
               _loc3_ = PlayerConfig.rootData.videoId;
               this._conductor.playNewVideo(_loc3_);
               break;
         }
      }
      
      private function onCommonUIEvent(param1:PluginEvent) : void {
         switch(param1.type)
         {
            case PluginEvent.POST_VIDEO_SCREEN_COMPLETE:
               this._playerProxy.removeEventListener(PluginEvent.POST_VIDEO_SCREEN_COMPLETE,this.onCommonUIEvent);
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_POST_VIDEO_SCREEN));
               this._conductor.postVideoDone();
               break;
            case PluginEvent.PRE_VIDEO_SCREEN_COMPLETE:
               this._playerProxy.removeEventListener(PluginEvent.PRE_VIDEO_SCREEN_COMPLETE,this.onCommonUIEvent);
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_PRE_VIDEO_SCREEN));
               this._conductor.preVideoDone();
               break;
            case PluginEvent.VIDEO_LAYER_CLOSE_FULLSCREEN:
               if(PlayerConfig.isFullScreen)
               {
                  this.changeFullScreenMode();
               }
               break;
            case PluginEvent.VIDEO_LAYER_TOGGLE_FULLSCREEN:
               this.changeFullScreenMode();
               break;
            case PluginEvent.VIDEO_LAYER_TOGGLE_PLAYPAUSE:
               if(this._conductor.currentState == ConductorState.VIDEO)
               {
                  this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_TOGGLE_PAUSEPLAY,{"useraction":true}));
               }
               break;
            case PluginEvent.READY_TO_PLAY_CLICK:
               this._playerProxy.removeEventListener(PluginEvent.READY_TO_PLAY_CLICK,this.onCommonUIEvent);
               this._conductor.userPlay();
               break;
         }
      }
      
      private function addCoreEvents() : void {
         var _loc1_:Array = [];
         _loc1_.push(CoreEvent.CONNECT_START);
         _loc1_.push(CoreEvent.CONNECT_DONE);
         _loc1_.push(CoreEvent.PLAYING);
         _loc1_.push(CoreEvent.JUMP_PLAY);
         _loc1_.push(CoreEvent.SEEK);
         _loc1_.push(CoreEvent.PLAY_START);
         _loc1_.push(CoreEvent.PLAY_OVER);
         _loc1_.push(CoreEvent.PLAY_VIDEO_BY_ID);
         _loc1_.push(CoreEvent.AUTO_PLAYED);
         _loc1_.push(CoreEvent.INITED);
         _loc1_.push(CoreEvent.PAUSE);
         _loc1_.push(CoreEvent.RESUME);
         _loc1_.push(CoreEvent.QUALITY_CHANGED);
         _loc1_.push(CoreEvent.SCREEN_MODE_CHANGED);
         _loc1_.push(CoreEvent.BUFFER_FULL);
         _loc1_.push(CoreEvent.BUFFER_EMPTY);
         _loc1_.push(CoreEvent.BUFFER_PERCENT);
         _loc1_.push(CoreEvent.GOT_METADATA);
         this._dispatcherEvents["core"] = 
            {
               "dispatcher":this._core,
               "events":_loc1_
            };
      }
      
      public function playPreVideoList() : void {
         if(this._playerProxy.playerData.videoListPreVideo == null)
         {
            return;
         }
         var _loc1_:Object = new Object();
         _loc1_.vid = this._playerProxy.playerData.videoListPreVideo.vid;
         _loc1_.vidEncoded = this._playerProxy.playerData.videoListPreVideo.vidEncoded;
         _loc1_.isFullScreen = this._playerProxy.playerData.isInFullScreen;
         _loc1_.Type = PlayerConfig.rootData.type;
         _loc1_.Fid = PlayerConfig.rootData.fid;
         _loc1_.Ob = PlayerConfig.rootData.ob;
         _loc1_.Pt = int(PlayerConfig.rootData.pt) - 1 < 0?0:int(PlayerConfig.rootData.pt) - 1;
         this._externalInterfaceProxy.PlayerPlayPre(_loc1_);
         if(this._playerProxy.playerData.isInFullScreen)
         {
            PlayerConfig.rootData.pt = String(_loc1_.Pt);
            this.playNewVideo(this._playerProxy.playerData.videoListPreVideo.vidEncoded);
         }
      }
      
      public function playNextVideoList() : void {
         if(this._playerProxy.playerData.videoListNextVideo == null)
         {
            return;
         }
         var _loc1_:Object = new Object();
         _loc1_.vid = this._playerProxy.playerData.videoListNextVideo.vid;
         _loc1_.vidEncoded = this._playerProxy.playerData.videoListNextVideo.vidEncoded;
         _loc1_.isFullScreen = this._playerProxy.playerData.isInFullScreen;
         _loc1_.Type = PlayerConfig.rootData.type;
         _loc1_.Fid = PlayerConfig.rootData.fid;
         _loc1_.Ob = PlayerConfig.rootData.ob;
         _loc1_.Pt = int(PlayerConfig.rootData.pt) + 1;
         this._externalInterfaceProxy.PlayerPlayNext(_loc1_);
         if(this._playerProxy.playerData.isInFullScreen)
         {
            PlayerConfig.rootData.pt = String(_loc1_.Pt);
            this.playNewVideo(this._playerProxy.playerData.videoListNextVideo.vidEncoded);
         }
      }
      
      public function tryToPlayProgram(param1:IProgramData) : void {
         var _loc2_:String = null;
         if(this._playerProxy.playerData.isInFullScreen)
         {
            PlayerConfig.rootData.pt = String(param1.position);
            this.playNewVideo(param1.videoID);
         }
         else
         {
            _loc2_ = param1.URL;
            if(this._playerProxy.rootGetData.rootWinType != "interior")
            {
               OpenWindow.open(new URLRequest(_loc2_),"_blank");
            }
            else
            {
               OpenWindow.open(new URLRequest(_loc2_),"_self");
            }
         }
      }
      
      public function changeVoice(param1:String) : void {
         var _loc5_:* = 0;
         var _loc2_:IPlayListData = PlayerConfig.playListData;
         var _loc3_:String = _loc2_.vidEncoded;
         var _loc4_:* = "";
         if(_loc2_.dvdinfo)
         {
            _loc5_ = 0;
            while(_loc5_ < _loc2_.dvdinfo.audioLangs.length)
            {
               if(_loc2_.dvdinfo.audioLangs[_loc5_].lang == param1)
               {
                  _loc4_ = _loc2_.dvdinfo.audioLangs[_loc5_].vid;
               }
               _loc5_++;
            }
         }
         if(_loc4_ != "")
         {
            PlayerConfig.dvdVoiceVid = _loc4_;
            PlayerConfig.dvdPlay = true;
            PlayerConfig.dvdTime = this._playerProxy.playerData.videoNsTime;
            PlayerConfig.dvdSID = _loc2_.sid;
            PlayerConfig.dvdoip = _loc2_.oip;
            PlayerConfig.dvdtoken = _loc2_.tk;
            this._conductor.playNewVideo(_loc3_,true);
         }
      }
      
      private function get isOuterPlayer() : Boolean {
         var _loc1_:IRootData = PlayerConfig.rootData;
         if(_loc1_.winType == "exterior" || _loc1_.winType == "BDskin")
         {
            return true;
         }
         return false;
      }
      
      public function changeFullScreenMode() : void {
         this.viewManager.changeFullScreen();
      }
      
      public function stopVideo() : void {
         this._conductor.stopVideo();
      }
      
      public function playNewVideoAndStop(param1:String) : void {
         PlayerConfig.rootData.autoPlay = false;
         this._holdonPlayVidEncoded = param1;
         this._conductor.playNewVideo(param1);
      }
      
      public function playNewVideo(param1:String, param2:Boolean = false) : void {
         if((this.viewManager.isInFullScreen) || true)
         {
            this._skipFrontAD = param2;
            this._holdonPlayVidEncoded = param1;
            this._conductor.playNewVideo(param1);
         }
      }
      
      public function playVideo() : void {
         this._playerProxy.addEventListener(CoreEvent.BUFFER_APPEARED,this.onCoreEvent);
         this._playerProxy.addEventListener(CoreEvent.PLAY_START,this.onCoreEvent);
         this._playerProxy.addEventListener(CoreEvent.PLAY_OVER,this.onCoreEvent);
         this._playerProxy.addEventListener(CoreEvent.YK_GET_P2P_REMOVE_URL,this.onCoreEvent);
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_LOADING));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.VIDEO_START_TO_PLAY));
         this.requestAndPlayAd("preroll");
      }
      
      public function realStartToLoadVideo() : void {
         var _loc1_:Number = PlayerConfig.startPosition;
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PLAY_WAIT_LOAD,{"starttime":_loc1_}));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_LOADING));
      }
      
      private function judgeStartPosition() : Number {
         this._jumpHeadTail = false;
         this._restorLastPosition = false;
         this._restorServerPosition = false;
         var _loc1_:Number = 0;
         var _loc2_:Number = 0;
         var _loc3_:Number = 0;
         var _loc4_:Number = 0;
         var _loc5_:IPlayListData = PlayerConfig.playListData;
         var _loc6_:IRootData = PlayerConfig.rootData;
         if(!(_loc5_.dvdinfo == null) && !(_loc5_.dvdinfo.headPostion == -1) && (_loc6_.jump))
         {
            this._jumpHeadTail = true;
            _loc2_ = _loc5_.dvdinfo.headPostion;
         }
         var _loc7_:Object = this._playerProxy.fsoProxy.getUserWatchingRecord(_loc5_.vidEncoded);
         if(_loc7_ != null)
         {
            this._restorLastPosition = true;
            _loc3_ = _loc7_.position;
         }
         if(_loc5_.lastpoint != -1)
         {
            _loc4_ = int(_loc5_.lastpoint / 1000);
            if(_loc7_ == null)
            {
               this._restorServerPosition = true;
               this._restorLastPosition = false;
               _loc3_ = _loc4_;
            }
            else if(Math.abs(_loc3_ - _loc4_) > 60)
            {
               this._restorServerPosition = true;
               this._restorLastPosition = false;
               _loc3_ = _loc4_;
            }
            else
            {
               this._restorServerPosition = false;
               this._restorLastPosition = true;
               _loc3_ = _loc3_;
            }
            
         }
         if((this._restorLastPosition) || (this._restorServerPosition))
         {
            this._jumpHeadTail = false;
            _loc1_ = _loc3_;
         }
         else if(this._jumpHeadTail)
         {
            _loc1_ = _loc2_ / 1000;
         }
         else
         {
            _loc1_ = 0;
         }
         
         if(_loc5_.trial)
         {
            this._jumpHeadTail = false;
            this._restorLastPosition = false;
            this._restorServerPosition = false;
            _loc1_ = 0;
         }
         if(_loc6_.firstTime > 0)
         {
            this._jumpHeadTail = false;
            this._restorLastPosition = false;
            this._restorServerPosition = false;
            _loc1_ = _loc6_.firstTime;
            _loc6_.firstTime = 0;
         }
         if(PlayerConfig.dvdPlay)
         {
            this._jumpHeadTail = false;
            this._restorLastPosition = false;
            this._restorServerPosition = false;
            _loc1_ = PlayerConfig.dvdTime;
         }
         return _loc1_;
      }
      
      public function playAD() : void {
         if(this._currentADType == "preroll")
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PAUSE,{"useraction":false}));
            if(this._skipFrontAD)
            {
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.REQUEST_AND_PLAY_FRONT_AD,{"skip":this._skipFrontAD}));
               this._skipFrontAD = false;
            }
            else
            {
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.REQUEST_AND_PLAY_FRONT_AD));
            }
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.AD_START_TO_PLAY));
         }
         else if(this._currentADType == "postroll")
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PAUSE,{"useraction":false}));
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.REQUEST_AND_PLAY_BACK_AD));
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.AD_START_TO_PLAY));
         }
         else if(this._currentADType == "middle")
         {
            this._playerProxy.addEventListener(CoreEvent.TWEEN_HIDE_COMPLETE,this.onCoreTweenHideComplete);
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_TWEEN_HIDE_AND_PAUSE));
         }
         
         
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.REQUEST_AND_PLAY_AD,{"type":this._currentADType}));
      }
      
      private function onCoreTweenHideComplete(param1:CoreEvent) : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.AD_START_TO_PLAY));
         this._playerProxy.removeEventListener(CoreEvent.TWEEN_HIDE_COMPLETE,this.onCoreTweenHideComplete);
      }
      
      public function playADDone() : void {
         if(this._currentADType == "preroll")
         {
            this.realStartToPlayVideo();
         }
         else if(this._currentADType == "middle")
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_TWEEN_SHOW_AND_PLAY,{"adtype":this._currentADType}));
         }
         else if(this._currentADType == "postroll")
         {
            this._conductor.videoEnd();
         }
         
         
      }
      
      private function realStartToPlayVideo() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_TWEEN_SHOW_AND_PLAY,{"adtype":this._currentADType}));
         this.showStartPlayInfo();
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_LOADING));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_START_TO_PLAY));
         var _loc1_:IPlayListData = PlayerConfig.playListData;
         var _loc2_:IRootData = PlayerConfig.rootData;
         var _loc3_:Object = new Object();
         _loc3_.vid = PlayerConfig.playListData.videoId;
         _loc3_.vidEncoded = PlayerConfig.playListData.vidEncoded;
         _loc3_.pt = PlayerConfig.rootData.pt;
         this._externalInterfaceProxy.onPlayerStart(_loc3_);
      }
      
      private function showStartPlayInfo() : void {
         var _loc3_:* = false;
         var _loc4_:String = null;
         var _loc5_:String = null;
         var _loc1_:IPlayListData = PlayerConfig.playListData;
         var _loc2_:IRootData = PlayerConfig.rootData;
         if(PlayerConfig.dvdPlay)
         {
            return;
         }
         if(this._restorLastPosition)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.INFO_RESTORE_LAST));
         }
         else if(this._restorServerPosition)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.INFO_RESTORE_SERVER));
         }
         else if(this._jumpHeadTail)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.INFO_JUMP_HEAD));
         }
         
         
         if(!_loc2_.jump && !(_loc1_.dvdinfo == null) && !(_loc1_.dvdinfo.headPostion == -1))
         {
            if(!this._restorLastPosition && !this._jumpHeadTail)
            {
               this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.INFO_JUMP_HEAD_SETTING));
            }
         }
         if(!(_loc1_.fileType == "hd2") && !(_loc1_.typeArr == null))
         {
            _loc3_ = false;
            for each(_loc4_ in _loc1_.typeArr)
            {
               if(_loc4_.toLowerCase() == "hd2")
               {
                  _loc3_ = true;
                  break;
               }
            }
            if(_loc3_)
            {
            }
         }
         if(_loc1_.trial)
         {
            _loc5_ = "";
            if(_loc1_.trial.type == "time")
            {
               _loc5_ = "前" + int(_loc1_.trial.time / 60) + "分钟";
            }
            else if(_loc1_.trial.type == "episodes")
            {
               _loc5_ = "前" + _loc1_.trial.episodes + "集";
            }
            
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.INFO_TRIAL,{"text":_loc5_}));
         }
      }
      
      private function requestAndPlayAd(param1:String) : void {
         this._currentADType = param1;
         this._conductor.gotoPlayAd();
      }
      
      public function readyToPlay() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_READY_TO_PLAY));
         var _loc1_:Object = new Object();
         _loc1_.continuous = PlayerConfig.rootData.continuous?1:0;
         this._externalInterfaceProxy.onPlayerSet(_loc1_);
      }
      
      public function showReadyToPlay() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_READY_TO_PLAY_SCREEN));
      }
      
      public function playPreVideo() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_LOADING));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_PRE_VIDEO_SCREEN));
      }
      
      public function playPostVideo() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_POST_VIDEO_SCREEN));
      }
      
      public function showVideoEnd() : void {
         var _loc1_:String = null;
         var _loc2_:String = null;
         var _loc3_:String = null;
         var _loc4_:String = null;
         if((this._playerProxy.playerData.trialInfo) && (this._playerProxy.playerData.trialInfo.endTime))
         {
            _loc1_ = ErrorLevel.FATAL_ERROR;
            _loc2_ = ErrorCode.PAY_TRIAL_END_NOT_LOGIN;
            _loc3_ = ErrorType.PAY_TRIAL_END_NOT_LOGIN;
            _loc4_ = "";
            this._playerProxy.dispatchEvent(new PluginEvent(PluginEvent.PLUGIN_ERROR,
               {
                  "level":_loc1_,
                  "message":_loc4_,
                  "type":_loc3_,
                  "code":_loc2_
               }));
            return;
         }
         if(this.shouldShowEndCard)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PAUSE,{"useraction":false}));
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_END_CARD));
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SEARCHBAR_RETAIN));
         }
      }
      
      private function jsCallPlayerComplete() : void {
         var _loc1_:IRootData = PlayerConfig.rootData;
         var _loc2_:IPlayListData = PlayerConfig.playListData;
         var _loc3_:Object = new Object();
         _loc3_.vid = null;
         _loc3_.vidEncoded = null;
         if(this._playerProxy.playerData.videoListNextVideo != null)
         {
            _loc3_.vid = this._playerProxy.playerData.videoListNextVideo.vid;
            _loc3_.vidEncoded = this._playerProxy.playerData.videoListNextVideo.vidEncoded;
         }
         _loc3_.isFullScreen = this._playerProxy.playerData.isInFullScreen;
         _loc3_.loop = PlayerContext.loopPlay;
         _loc3_.Type = "";
         _loc3_.Fid = "";
         _loc3_.Ob = "";
         _loc3_.Pt = "";
         var _loc4_:Number = Number(_loc1_.pt);
         if(_loc1_.type == "Folder")
         {
            _loc3_.Type = _loc1_.type;
            _loc3_.Fid = _loc1_.fid;
            _loc3_.Ob = _loc1_.ob;
            _loc3_.Pt = "";
            if(!(_loc2_.folder == null) && _loc4_ < _loc2_.folder.total - 1)
            {
               if(_loc1_.continuous)
               {
                  _loc4_ = _loc4_ + 1;
               }
               _loc3_.Pt = _loc4_;
            }
         }
         this._externalInterfaceProxy.onPlayerComplete(_loc3_);
      }
      
      private function jsCallOnTrialEnd() : void {
         this._externalInterfaceProxy.onTrialEnd();
      }
      
      public function onVideoEnd() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.VIDEO_END));
         this.jsCallPlayerComplete();
         var _loc1_:IRootData = PlayerConfig.rootData;
         var _loc2_:Number = Number(_loc1_.pt);
         if(PlayerContext.loopPlay)
         {
            setTimeout(this._conductor.replay,300,0);
            return;
         }
         if(this._playerProxy.playerData.isInFullScreen)
         {
            if(!(this._playerProxy.playerData.videoListNextVideo == null) && ((this._playerProxy.playerData.isContinuous) || (this._playerProxy.playerData.isTouchPlayer)) && !(_loc1_.winType == "exterior") && !(_loc1_.winType == null) && !PlayerConfig.isTudouPlayer)
            {
               _loc1_.pt = String(_loc2_);
               this.playNewVideo(this._playerProxy.playerData.videoListNextVideo.vidEncoded);
               return;
            }
         }
         if(!this.shouldShowEndCard && !PlayerContext.loopPlay)
         {
            this.showReadyToPlay();
         }
      }
      
      private function get shouldShowEndCard() : Boolean {
         var _loc1_:Boolean = PlayerConfig.rootData.isShowRelativeVideo;
         var _loc2_:IRootData = PlayerConfig.rootData;
         if((PlayerConfig.rootData.isLoop) || (_loc2_.showLoop) && (this._playerProxy.fsoProxy.getLoopSetting()))
         {
            _loc1_ = false;
         }
         return _loc1_;
      }
      
      public function replayVideoFromEnd(param1:Number) : void {
         this._playerProxy.addEventListener(CoreEvent.BUFFER_APPEARED,this.onCoreEvent);
         this._playerProxy.addEventListener(CoreEvent.PLAY_START,this.onCoreEvent);
         this._playerProxy.addEventListener(CoreEvent.PLAY_OVER,this.onCoreEvent);
         this._playerProxy.addEventListener(CoreEvent.YK_GET_P2P_REMOVE_URL,this.onCoreEvent);
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.HIDE_END_CARD));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_SEEK,{"time":param1}));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_START_TO_PLAY));
         this._playerProxy.dispatchEvent(new ReportEvent(ReportEvent.REPLAY_REPORT));
         var _loc2_:Object = new Object();
         _loc2_.vid = PlayerConfig.playListData.videoId;
         _loc2_.vidEncoded = PlayerConfig.playListData.vidEncoded;
         _loc2_.pt = PlayerConfig.rootData.pt;
         this._externalInterfaceProxy.onPlayerStart(_loc2_);
      }
      
      public function onResume() : void {
         if(this._conductor.currentState == ConductorState.READY_TO_PLAY)
         {
            this._conductor.userPlay();
         }
         else if(this._conductor.currentState == ConductorState.VIDEO)
         {
            this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_RESUME));
         }
         else if(this._conductor.currentState == ConductorState.VIDEO_END)
         {
            this._conductor.replay(0);
         }
         
         
      }
      
      public function meetError() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_ERROR,this._errorMsg));
         var _loc1_:Object = new Object();
         _loc1_.vid = this._playerProxy.playerData.videoIdUncode;
         _loc1_.vidEncoded = this._playerProxy.playerData.videoIdEncode;
         _loc1_.pt = PlayerConfig.rootData.pt;
         this._externalInterfaceProxy.onPlayerError(_loc1_);
      }
      
      public function reset() : void {
         this._jumpHeadTail = false;
         this._restorLastPosition = false;
         this._startToLoadVideo = false;
         this._currentADType = "";
         PlayerConfig.bctime = 0;
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.COMMON_RESET));
      }
      
      public function loadMetaData(param1:String) : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.CORE_PLAY_NEW_VIDEO,param1));
      }
      
      public function showToolBox(param1:String) : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.BEFORE_SHOW_PANELS,{"panel":PlayerConstant.PANEL_TOOLBOX}));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_TOOLBOX,{"type":param1}));
      }
      
      public function showShareBox(param1:String, param2:Number = 0) : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.BEFORE_SHOW_PANELS,{"panel":PlayerConstant.PANEL_SHARE}));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.SHOW_SHARE,
            {
               "from":param1,
               "time":param2
            }));
      }
      
      public function showProgramList() : void {
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.BEFORE_SHOW_PANELS,{"panel":PlayerConstant.PANEL_PROGRAM_LIST}));
         this._playerProxy.dispatchEvent(new PlayerControlEvent(PlayerControlEvent.PROGRAMLIST_SHOW));
      }
      
      public function addInitDependence(param1:Object) : void {
         if(this._initDependenceChecker == null)
         {
            this._initDependenceChecker = new DependenceChecker();
         }
         this._initDependenceChecker.addDependence(param1);
      }
      
      public function removeInitDependence(param1:Object) : void {
         if(this._initDependenceChecker == null)
         {
            return;
         }
         this._initDependenceChecker.removeDependence(param1);
         this.checkDependences();
      }
   }
}
